#include "resourceswidget.h"
#include "resourcelistwidget.h"
#include <QDesktopServices>
#include <QDir>
#include <QPushButton>
ResourcesWidget::ResourcesWidget()
{
    this->setAcceptDrops(true);

    ResourceListWidget *resourceListWidget = new ResourceListWidget(this);
    this->setWidget(resourceListWidget);
}
ResourcesWidget::~ResourcesWidget()
{
}
void ResourcesWidget::dragEnterEvent(QDragEnterEvent *event)
{
    event->acceptProposedAction();
}

void ResourcesWidget::dropEvent(QDropEvent *event)
{
    ResourceListWidget* rlw = dynamic_cast<ResourceListWidget*>(event->source());
    if(rlw)
    {
        return;
    }
    QString tmp = event->mimeData()->urls().first().toString();
    int pos = tmp.lastIndexOf(":");
    QString fname = tmp.mid(pos - 1);
    fname.replace("/","//");
    FileManager::Instance().CopyFile(fname,FileManager::Instance().curPath,true);
    emit EventCenter::Instance().RefreshFileList(FileManager::Instance().curPath);
}
